Skip to content

feat(capi): add t4a_treetn_swap_site_indices#399

Merged
shinaoka merged 1 commit intomainfrom
feat/capi-linop-swap
Apr 7, 2026
Merged

feat(capi): add t4a_treetn_swap_site_indices#399
shinaoka merged 1 commit intomainfrom
feat/capi-linop-swap

Conversation

@shinaoka
Copy link
Copy Markdown
Member

@shinaoka shinaoka commented Apr 7, 2026

Summary

  • Expose TreeTN::swap_site_indices via C API

Details

New C function t4a_treetn_swap_site_indices(ttn, index_ids, target_vertices, n_pairs, max_rank, rtol) that rearranges site indices on a TreeTN so each specified index ends up at its target vertex. Values are preserved via SVD factorization.

Used by Tensor4all.jl's swap_site_indices! and rearrange_siteinds (tensor4all/Tensor4all.jl#30).

Test plan

  • cargo build -p tensor4all-capi --release passes
  • Adjacent 2-site swap verified via Julia wrapper

🤖 Generated with Claude Code

Expose TreeTN::swap_site_indices via C API. Takes parallel arrays of
(index_id, target_vertex) pairs plus SVD truncation options (max_rank, rtol).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinaoka shinaoka enabled auto-merge April 7, 2026 11:20
@shinaoka shinaoka merged commit da19903 into main Apr 7, 2026
4 checks passed
@shinaoka shinaoka deleted the feat/capi-linop-swap branch April 7, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant